<template>
    <el-config-provider :locale="zhCn">
        <router-view />
    </el-config-provider>
</template>

<script setup lang="ts">
import { ElConfigProvider } from 'element-plus';
import {check} from './api/user'
import {useUserStore} from './store/user'
import zhCn from 'element-plus/es/locale/lang/zh-cn';

// 每次进入系统判断是否登录

const user = useUserStore();
// 每次登录检查是否存在登录信息
const checkLogin = () =>{
    if(user.isLogin) return;
    check({}).then((res:any)=>{
        if(res.code !== 200) return;
        user.setUserInfo(res.data);
        user.changeLogin(true)
    })
}
checkLogin();
</script>
<style>
@import './assets/css/main.css';
@import './assets/css/color-dark.css';
</style>
